<?php
use think\facade\Route;

Route::post('login', 'Company/login')->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
]);;
Route::get('logout', 'Company/logout')->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
]);;
Route::get('down_cert', 'Plan/down_cert')->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
]);;



Route::get('index/statistics', 'Index/statistics')->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
]);

Route::post('index/changePassword', 'Index/changePassword')->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
]);

Route::get('index/getCompanyName', 'Index/getCompanyName')->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
]);

Route::group('department', function () {
    Route::group(function () {
        Route::get('list', 'Department/getDepartmentList')->option(['real_name' => '部门列表']);
//        Route::get('list', 'Department/getDepartmentList')->option(['real_name' => '部门列表']);
        Route::post('save', 'Department/saveDepartment')->option(['real_name' => '保存部门信息']);
        Route::get('info', 'Department/departmentInfo')->option(['real_name' => '部门信息']);
        Route::get('delete', 'Department/deleteDepartment')->option(['real_name' => '删除部门信息']);
    })->option(['parent' => 'department', 'cate_name' => '部门']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'department', 'mark_name' => '部门管理']);

Route::group('staff', function () {
    Route::group(function () {
        Route::get('certTypes', 'Staff/certTypes')->option(['real_name' => '人员证件类型']);
        Route::get('allStaffs', 'Staff/allStaffs')->option(['real_name' => '人员列表']);
        Route::get('getOptions', 'Staff/allStaffs')->option(['real_name' => '获取人员选择选项']);
        Route::post('list', 'Staff/getStaffList')->option(['real_name' => '人员列表']);
        Route::post('save', 'Staff/saveStaff')->option(['real_name' => '保存人员信息']);
        Route::get('info', 'Staff/staffInfo')->option(['real_name' => '人员信息详情']);
        Route::get('delete', 'Staff/deleteStaff')->option(['real_name' => '删除人员信息']);
        Route::post('resetPassword', 'Staff/resetPassword')->option(['real_name' => '重置密码']);
        Route::get('downloadTemplate', 'Staff/downloadImportTemplate')->option(['real_name' => '下载导入模板']);
        Route::post('import', 'Staff/importStaff')->option(['real_name' => '导入人员信息']);
    })->option(['parent' => 'staff', 'cate_name' => '人员']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'staff', 'mark_name' => '人员管理']);

Route::group('project', function () {
    Route::group(function () {
        Route::post('page', 'Project/page');
        Route::post('save', 'Project/saveProject');
        Route::get('info', 'Project/info');
    })->option(['parent' => 'project', 'cate_name' => '项目']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'project', 'mark_name' => '项目管理管理']);


Route::group('project_type', function () {
    Route::group(function () {
        Route::post('index', 'ProjectType/index');
        Route::post('save', 'ProjectType/save');
        Route::post('delete', 'ProjectType/delete');

    })->option(['parent' => 'project', 'cate_name' => '项目分类']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'project', 'mark_name' => '项目管理管理']);



Route::group('user', function () {
    Route::group(function () {
        Route::post('page', 'User/page');
        Route::post('save', 'User/save');
        Route::post('del', 'User/del');
    })->option(['parent' => 'user', 'cate_name' => '账号']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'user', 'mark_name' => '账号管理']);


Route::group('teacher', function () {
    Route::group(function () {
        Route::post('list', 'Teacher/list');
        Route::post('save', 'Teacher/save');
        Route::post('listAll', 'Teacher/listAll');
        Route::post('certTypes', 'Teacher/certTypes');
        Route::get('delete', 'Teacher/delete');
        Route::get('info', 'Teacher/info');
    })->option(['parent' => 'teacher', 'cate_name' => '教师']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'teacher', 'mark_name' => '教师']);

Route::group('plan', function () {
    Route::group(function () {
        Route::post('list', 'Plan/list');
        Route::post('save', 'Plan/save');
        Route::get('info', 'Plan/info');
        Route::post('courses', 'Plan/courses');
        Route::post('staffs', 'Plan/staffs');
        Route::post('staffsSnap', 'Plan/staffsSnap');
        Route::get('nullify', 'Plan/nullify');
        Route::get('removeStaff', 'Plan/removeStaff');
        Route::get('copy', 'Plan/copy');
        Route::get('online', 'Plan/online');
        Route::post('addStaff', 'Plan/addStaff');
        Route::post('staffsSnapList', 'Plan/staffsSnapList');
        Route::get('delStudentSnap', 'Plan/delStudentSnap');
        Route::post('uploadImageInfo', 'Plan/UploadImageInfo');
        Route::post('cartlist', 'Plan/cartlist');
        Route::post('selStatusChange', 'Plan/selStatusChange');
        Route::post('generateCert', 'Plan/generateCert');
        Route::get('statistics', 'Plan/statistics');
        Route::get('getCourseware', 'Plan/getCourseware');
        Route::get('down_cert', 'Plan/down_cert');
    })->option(['parent' => 'plan', 'cate_name' => '培训']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'plan', 'mark_name' => '培训']);

Route::group('course', function () {
    Route::group(function () {
        Route::post('list', 'Course/list');
        Route::post('save', 'Course/save');
        Route::get('info', 'Course/info');
        Route::get('delete', 'Course/delete');
        Route::get('wares', 'Course/selectCourseWares');
    })->option(['parent' => 'course', 'cate_name' => '课程']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'course', 'mark_name' => '课程']);

Route::group('courseware', function () {
    Route::group(function () {
        Route::post('list', 'Courseware/list');
        Route::post('save', 'Courseware/save');
        Route::get('info', 'Courseware/info');
        Route::get('delete', 'Courseware/delete');
        Route::get('topics', 'Courseware/topics');
    })->option(['parent' => 'courseware', 'cate_name' => '课件']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'courseware', 'mark_name' => '课件']);

Route::group('exam', function () {
    Route::group(function () {
        Route::post('list', 'Exam/list');
        Route::post('save', 'Exam/save');
        Route::post('addTopic', 'Exam/addTopic');
        Route::get('info', 'Exam/info');
        Route::get('delete', 'Exam/delete');
        Route::get('deleteTopic', 'Exam/deleteTopic');
        Route::post('topics', 'Exam/topics');
        Route::get('switchSort', 'Exam/switchSort');
        Route::post('saveTopic', 'Exam/saveTopic');
    })->option(['parent' => 'exam', 'cate_name' => '试卷']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'exam', 'mark_name' => '试卷']);

Route::group('topic', function () {
    Route::group(function () {
        Route::post('list', 'Topic/list');
        Route::post('save', 'Topic/save');
        Route::post('addTopic', 'Topic/addTopic');
        Route::get('info', 'Topic/info');
        Route::get('delete', 'Topic/delete');
        Route::post('upload', 'Topic/uploadFile');
        Route::post('random', 'Topic/randomGenerateTopic');
    })->option(['parent' => 'topic', 'cate_name' => '试题']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'topic', 'mark_name' => '试题']);

Route::group('archive', function () {
    Route::group(function () {
        Route::get('training_record', 'ArchiveController/getTrainingRecord')->option(['real_name' => '获取人员培训档案']);
        Route::get('download_pdf', 'ArchiveController/downloadPdf')->option(['real_name' => '下载学员培训档案PDF']);
    })->option(['parent' => 'archive', 'cate_name' => '档案']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'archive', 'mark_name' => '档案管理']);


Route::group('disclose', function () {
    Route::group(function () {
        Route::get('types', 'DiscloseType/list');
        Route::post('type/save', 'DiscloseType/save');
        Route::get('type/info', 'DiscloseType/info');
        Route::get('type/delete', 'DiscloseType/delete');
        Route::post('list', 'Disclose/list');
        Route::post('save', 'Disclose/save');
        Route::get('info', 'Disclose/info');
        Route::get('staffs', 'Disclose/staffs');
        Route::get('nullify', 'Disclose/nullify');
        Route::get('getDiscloseAutographs', 'Disclose/getDiscloseAutographs');
    })->option(['parent' => 'disclose', 'cate_name' => '交底']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'disclose', 'mark_name' => '交底']);

Route::group('offlinetraining', function () {
    Route::group(function () {
        Route::post('list', 'OfflineTraining/list');
        Route::post('save', 'OfflineTraining/save');
        Route::get('info', 'OfflineTraining/info');
        Route::get('delete', 'OfflineTraining/delete');
    })->option(['parent' => 'offlinetraining', 'cate_name' => '线下培训']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'offlinetraining', 'mark_name' => '线下培训']);

Route::group('train', function () {
    Route::group(function () {
        Route::post('list', 'Train/list');
        Route::post('save', 'Train/save');
        Route::get('info', 'Train/info');
        Route::get('delete', 'Train/delete');
    })->option(['parent' => 'Train', 'cate_name' => '线下培训']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'Train', 'mark_name' => '线下培训']);

Route::group('trainType', function () {
    Route::group(function () {
        Route::get('tree', 'TrainType/trainTypeTree');
    })->option(['parent' => 'trainType', 'cate_name' => '培训类型']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'trainType', 'mark_name' => '培训类型']);

Route::group('systemType', function () {
    Route::group(function () {
        Route::get('merchantType', 'SystemType/merchantType');
    })->option(['parent' => 'merchantType', 'cate_name' => '系统类型']);;
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'merchantType', 'mark_name' => '系统类型']);

Route::group('article', function () {
    Route::group(function () {
        Route::get('types', 'Article/types')->option(['real_name' => '获取文章分类列表']);
        Route::get('list', 'Article/list')->option(['real_name' => '获取文章列表']);
        Route::get('detail', 'Article/detail')->option(['real_name' => '获取文章详情']);
    })->option(['parent' => 'article', 'cate_name' => '咨询']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
   \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'article', 'mark_name' => '文章列表']);

Route::group('trainData', function () {
    Route::group(function () {
        Route::get('list', 'TrainData/list')->option(['real_name' => '获取培训记录列表']);
        Route::get('types', 'TrainData/types')->option(['real_name' => '获取培训类型树形结构']);
        Route::get('detail', 'TrainData/detail')->option(['real_name' => '获取培训记录详情']);
    })->option(['parent' => 'trainData', 'cate_name' => '培训数据']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
])->option(['mark' => 'trainData', 'mark_name' => '培训数据管理']);


// 获取参数列表
Route::get('parameter/list', 'Parameter/listAll')->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
]);

//Route::post('position/list', 'Parameter/listAll')->middleware([
//    \app\http\middleware\AllowOriginMiddleware::class,
//    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
//]);


// 获取工种岗位
Route::get('parameter/listtype4', 'Parameter/listType4')->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
]);

Route::post('upload', 'Upload/upload')->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
]);

Route::group('position', function () {
    Route::group(function () {
        Route::post('list', 'Position/list')->option(['real_name' => '获取岗位工种列表']);
        Route::get('tree', 'Position/tree')->option(['real_name' => '获取岗位工种结构']);
        Route::get('info', 'Position/info')->option(['real_name' => '获取岗位工种详情']);
        Route::post('save', 'Position/save')->option(['real_name' => '保存或修改岗位工种']);
    })->option(['parent' => 'position', 'cate_name' => '培训数据']);
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\enterprise\middleware\EnterpriseAuthTokenMiddleware::class
]);